<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;
use Carbon\Carbon;

/**
 * Class DormMeterRecord.
 *
 * @package namespace App\Models;
 */
class DormMeterRecord extends BaseModel implements Transformable
{
    use TransformableTrait;


    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['period_id', 'dorm_id', 'dorm_meter_id', 'user_id', 'client_id', 'meter_type_id', 'prev_meter_reading', 'prev_reading_date', 'meter_reading', 'meter_reading_date', 'day_span', 'consume', 'remark'];

    public function period()
    {
        return $this->belongsTo(Period::class);
    }
    public function dorm()
    {
        return $this->belongsTo(Dorm::class);
    }

    public function meterType()
    {
        return $this->belongsTo(MeterType::class);
    }

    public function dormMeter()
    {
        return $this->belongsTo(DormMeter::class);
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
